<template>
  <div>
    <div class="user_info">
      <div><span>就诊人：</span>{{ info.patientName }}</div>
      <div>
        <span>性别：</span>
        <template v-if="info.patientSex == 'M'">男</template>
        <template v-if="info.patientSex == 'F'">女</template>
      </div>
      <div><span>年龄：</span>{{ info.patientAge }}</div>
    </div>
    <div class="gapbox"></div>
    <div class="hos_info"><span>就诊科室：</span>{{ info.patientDate }}</div>
    <div class="hos_info">
      <span>就诊医生：</span>{{ info.patientZydoctor }}
    </div>
    <div class="hos_info"><span>病床号码：</span>{{ info.patientBed }}</div>
    <div class="hos_info"><span>入院日期：</span>{{ info.patientIndate }}</div>
    <div class="hos_info"><span>出院日期：</span>{{ info.patientOutdate }}</div>
    <div class="hos_info"><span>诊断结果：</span>{{ info.patientIndise }}</div>

    <div class="gapbox"></div>
    <div class="tit_box"><span></span>住院日清单</div>
    <div class="tower" @click="goHospitalDayList">
      <div>住院日清单</div>
      <img src="@/assets/img/right.png" alt="" />
    </div>
    <div class="gapbox"></div>
    <div class="tit_box"><span></span>检验检查</div>
    <div class="tower" @click="goCheckList">
      <div>查看报告</div>
      <img src="@/assets/img/right.png" alt="" />
    </div>
    <!-- <div class="gapbox"></div>
    <div class="tit_box"><span></span>出院报告</div>
    <div class="tower" @click="goDischargeMedication">
      <div>出院带药</div>
      <img src="@/assets/img/right.png" alt="" />
    </div>
    <div class="tower" @click="goDischargeAbstract">
      <div>出院小结</div>
      <img src="@/assets/img/right.png" alt="" />
    </div> -->
  </div>
</template>
<script>
import { getInpatientInMainInfoList } from "@/api/api";
export default {
  components: {},
  data() {
    return {
      info: {},
    };
  },
  created() {
    if (this.$route.query) {
      this.getInpatientInMainInfoList();
    }
  },
  methods: {
    // 查询患者住院信息
    getInpatientInMainInfoList() {
      var data = {
        inpatientSerialNo: this.$route.query.inpatientSerialNo,
      };
      getInpatientInMainInfoList(data).then((res) => {
        if (res.code == 200) {
          this.info = res.data.patientInfo;
        }
      });
    },
    formatDateTime(date, fmt) {
      var date = new Date(date);
      if (/(y+)/.test(fmt)) {
        fmt = fmt.replace(
          RegExp.$1,
          (date.getFullYear() + "").substr(4 - RegExp.$1.length)
        );
      }
      var o = {
        "M+": date.getMonth() + 1,
        "d+": date.getDate(),
        "h+": date.getHours(),
        "m+": date.getMinutes(),
        "s+": date.getSeconds(),
      };
      for (var k in o) {
        if (new RegExp("(" + k + ")").test(fmt)) {
          var str = o[k] + "";
          fmt = fmt.replace(
            RegExp.$1,
            RegExp.$1.length === 1 ? str : ("00" + str).substr(str.length)
          );
        }
      }
      return fmt;
    },
    // 跳转住院日清单
    goHospitalDayList() {
      this.$router.push({
        path: "/hos_day_list",
        query: {
          inpatientSerialNo: this.$route.query.inpatientSerialNo,
          patientName: this.info.patientName,
          patientSex: this.info.patientSex,
          patientAge: this.info.patientAge,
          inDate: this.formatDateTime(this.info.patientIndate, "yyyy-MM-dd"),
          outDate: this.formatDateTime(this.info.patientOutdate, "yyyy-MM-dd"),
        },
      });
    },

    goCheckList() {
      this.$router.push({
        path: "/inspection",
      });
    },
  },
};
</script>
<style scoped>
.user_info {
  width: calc(100% - 2rem);
  padding: 1.0625rem 1rem 0.8125rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9375rem;
  border-top: 0.0625rem solid #e7ecf5;
}

.user_info > div > span {
  color: #949fb4;
}

.weui-cell {
  background-color: #f7fafd;
}

.weui-cell:before {
  border: none;
}

.gapbox {
  width: 100%;
  height: 0.625rem;
  background: rgba(247, 250, 253, 1);
}

.hos_info {
  width: calc(100% - 2rem);
  padding: 0.375rem 1rem;
  display: flex;
  /* line-height: 1.5rem; */
  /* justify-content: space-between; */
  font-size: 0.875rem;
}

.hos_info > div:nth-of-type(1) {
  width: 50%;
}
.hos_info > div:nth-of-type(2) {
  width: 50%;
}

.hos_info span {
  color: #949fb4;
  display: inline-block;
}

.tit_box {
  width: calc(100% - 2rem);
  padding: 1rem;
  font-size: 1.0625rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  padding-bottom: 0rem;
}

.tit_box span {
  display: block;
  width: 0.1875rem;
  height: 0.9375rem;
  background: rgba(90, 173, 251, 1);
  border-radius: 0.125rem;
  margin-right: 0.625rem;
}
.tower {
  background: white;
  width: calc(100% - 2rem);
  padding: 0.8125rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9375rem;
}
.tower img {
  width: 0.5rem;
  height: 0.8125rem;
}
.next_box {
  background: white;
  width: calc(100% - 2rem);
  height: 2.75rem;
  padding: 3rem 1rem 1.25rem 1rem;
  /* position: fixed;
  bottom: 1.25rem; */
}
.next_box > div {
  background: linear-gradient(90deg, #448eff 0%, #66a3ff 100%);
  border-radius: 0.19rem;
  height: 100%;
  width: 100%;
  text-align: center;
  line-height: 2.75rem;
  color: #fff;
}
</style>
